import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.WireMock;
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;

import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;

/**
 * Copyright © 2019年 testapi001. All rights reserved.
 *
 * @author 临江仙 hzqiuxm@163.com
 * wireMock示例
 * @date 2019/11/28 12:20
 */
public class Applicaiton {
    /**
     * 定义mock服务的端口
     */
    private static final int PORT = 9090;


    /**
     * 定义mock服务的地址
     */
    private static final  String LOCALHOST= "localhost";


    /**
     * 默认文件位置:src/test/resources
     * // Set the root of the filesystem WireMock will look under for files and mappings
     * .usingFilesUnderDirectory("/path/to/files-and-mappings-root")
     *
     * // Set a path within the classpath as the filesystem root
     * .usingFilesUnderClasspath("root/path/under/classpath")
     *
     * 定义mapping文件目录,从resources目录下配置不生效，使用绝对路径配置是可以得
     */
    private static final String MOCK_DIR= "mock";

    /**
     * main方法中的内容为启动mock服务的固定写法，大家在学习时，可以copy这里的代码直接使用
     * @param args
     */

    public static void main(String[] args) {


        System.out.println("================begin....===================");

        final WireMockConfiguration config = wireMockConfig()
                .port(PORT);
//                .usingFilesUnderClasspath(MOCK_DIR);


        final WireMockServer wireMockServer = new WireMockServer(config);
        wireMockServer.start();
        WireMock.configureFor(LOCALHOST,PORT);

        System.out.println("================end....===================");
    }



}
